<template>
	<view style="height: 100%;">
		<view class="centent">					
			<view class="bottombox" @tap="toweekfoodxiangqing(item.id)" v-if="weeklist.length>0" v-for="(item,index) in weeklist" :key="index">
				<view class="bottomcenter">
					<view class="moon">
						<!-- <view class="centermoon">
							<text>{{item.month}}月</text>
						</view> -->
					</view>
					<view class="jump">
						<image src="../../static/jiantou.png" mode=""></image>
					</view>
					<view class="title">
						<text>{{item.title}}</text>
					</view>
					<view class="time">
						<text>{{item.date}}发布</text>
						
					</view>
				</view>
			</view>						
		</view>
		<kongyemian v-if="weeklist.length<1" :isLoding="loding" type="food"></kongyemian>
	</view>
</template>

<script>
	import {
		mapState,
		mapGetters,
		mapMutation,
		mapActions
	} from 'vuex';
	export default {
		computed: {
			...mapState({
				userInfo: state => state.user.userInfo,				
				isLogin: state => state.user.isLogin
			})
		},
		data() {
			return {
				school_id:0,
				weeklist:[],
				loding:true

			}
		},
		methods: {
			toweekfoodxiangqing(id) {
				uni.navigateTo({
					url: '../weekfoodxiangqing/weekfoodxiangqing?id='+id
				})
			},
			weekfoodlist(){
				this.loding = true
				this.$store
					.dispatch('weekfoodlist', {
						school_id:this.school_id,
						token: this.userInfo.token,						
					})
					.then(res => {																										   
						this.weeklist = res.data.data
						this.loding = false						
					});
			}
			
		},
		onLoad(data) {
			this.school_id = data.school_id
			this.weekfoodlist()
		},
		onPullDownRefresh() {
			this.weekfoodlist()
			setTimeout(() => {
				uni.stopPullDownRefresh();
			}, 1500)
		}
	}
</script>

<style lang="less">
	page {
		height: 100%;
		background-color: #f4f4f4;
		box-sizing: border-box;

	}

	.centent {
		background-image: url(../../static/keding.png);
		background-size: 100% auto;
		background-repeat: no-repeat;
		width: 100%;
		height: 100%;
		padding-top: 40rpx;

		.bottombox {
			padding: 20rpx;
			width: 100%;
			height: 165rpx;
			box-sizing: border-box;

			.bottomcenter {
				position: relative;
				width: 100%;
				height: 100%;
				background-color: #fff;
				border-radius: 15rpx;
				box-shadow: 0rpx 4rpx 17rpx 4rpx rgba(188, 225, 237,0.35);				
				box-sizing: border-box;
				display: flex;
				flex-direction: column;
				.moon {
					position: absolute;
					left: 20rpx;
					width: 100rpx;
					height: 100%;
					display: flex;
					align-items: center;
					
					.centermoon {
						width: 100%;
						height: 50rpx;
						background-color: #fd9d37;
						border-radius: 10rpx;
						font-size: 28rpx;
						color: #fff;
						line-height: 50rpx;
						text-align: center;

					}
				}	
				.jump {
					position: absolute;
					right: 20rpx;
					height: 100%;
					display: flex;
					align-items: center;

					image {
						width: 27rpx;
						height: 45rpx;
					}
				}
				.title{
					padding-top: 20rpx;
					width: 100%;
					font-size: 35rpx;
					font-weight: bold;
					text-align: center;
					margin-bottom: 20rpx;
									
				}
				.time{
					box-sizing: border-box;
					width: 100%;
					font-size: 24rpx;
					color: #ccc;
					text-align:right;
					padding-right: 70rpx;
				}

			}
		}

	}
</style>
